Azure OpenAI API (preview:2025-01-01)

2025/02/20 • 20 new methods

ListBatches (new)
Description :  Gets a list of all batches owned by the Azure OpenAI resource.
Reference :  Link ¶

⚼ Request

GET:  /batches
{
after: string ,
limit: integer ,
}

⚐ Response (200)

{
object: enum ,
data:
[
{
id: string ,
object: enum ,
endpoint: string ,
errors:
{
object: enum ,
data:
[
{
code: string ,
message: string ,
param: string ,
line: integer ,
}
,
]
,
}
,
input_file_id: string ,
completion_window: string ,
status: enum ,
output_file_id: string ,
error_file_id: string ,
created_at: integer ,
in_progress_at: integer ,
expires_at: integer ,
finalizing_at: integer ,
completed_at: integer ,
failed_at: integer ,
expired_at: integer ,
cancelling_at: integer ,
cancelled_at: integer ,
request_counts:
{
total: integer ,
completed: integer ,
failed: integer ,
}
,
metadata: object ,
}
,
]
,
first_id: string ,
last_id: string ,
has_more: boolean ,
}
CreateBatch (new)
Description :  Creates and executes a batch from an uploaded file of requests. Response includes details of the enqueued job including job status. The ID of the result file is added to the response once complete.
Reference :  Link ¶

⚼ Request

POST:  /batches
{
createBatchRequest:
{
endpoint: string ,
input_file_id: string ,
completion_window: string ,
metadata: object ,
}
,
}

⚐ Response (201)

{
id: string ,
object: enum ,
endpoint: string ,
errors:
{
object: enum ,
data:
[
{
code: string ,
message: string ,
param: string ,
line: integer ,
}
,
]
,
}
,
input_file_id: string ,
completion_window: string ,
status: enum ,
output_file_id: string ,
error_file_id: string ,
created_at: integer ,
in_progress_at: integer ,
expires_at: integer ,
finalizing_at: integer ,
completed_at: integer ,
failed_at: integer ,
expired_at: integer ,
cancelling_at: integer ,
cancelled_at: integer ,
request_counts:
{
total: integer ,
completed: integer ,
failed: integer ,
}
,
metadata: object ,
}
GetBatch (new)
Description :  Gets details for a single batch specified by the given batchID.
Reference :  Link ¶

⚼ Request

GET:  /batches/{batchId}
{
batchId: string ,
}

⚐ Response (200)

{
id: string ,
object: enum ,
endpoint: string ,
errors:
{
object: enum ,
data:
[
{
code: string ,
message: string ,
param: string ,
line: integer ,
}
,
]
,
}
,
input_file_id: string ,
completion_window: string ,
status: enum ,
output_file_id: string ,
error_file_id: string ,
created_at: integer ,
in_progress_at: integer ,
expires_at: integer ,
finalizing_at: integer ,
completed_at: integer ,
failed_at: integer ,
expired_at: integer ,
cancelling_at: integer ,
cancelled_at: integer ,
request_counts:
{
total: integer ,
completed: integer ,
failed: integer ,
}
,
metadata: object ,
}
CancelBatch (new)
Description :  Gets details for a single batch specified by the given batchID.
Reference :  Link ¶

⚼ Request

POST:  /batches/{batchId}/cancel
{
batchId: string ,
}

⚐ Response (200)

{
id: string ,
object: enum ,
endpoint: string ,
errors:
{
object: enum ,
data:
[
{
code: string ,
message: string ,
param: string ,
line: integer ,
}
,
]
,
}
,
input_file_id: string ,
completion_window: string ,
status: enum ,
output_file_id: string ,
error_file_id: string ,
created_at: integer ,
in_progress_at: integer ,
expires_at: integer ,
finalizing_at: integer ,
completed_at: integer ,
failed_at: integer ,
expired_at: integer ,
cancelling_at: integer ,
cancelled_at: integer ,
request_counts:
{
total: integer ,
completed: integer ,
failed: integer ,
}
,
metadata: object ,
}
GenerateSpeechFromText (new)
Description :  Generates text-to-speech audio from the input text.
Reference :  Link ¶

⚼ Request

POST:  /deployments/{deploymentId}/audio/speech
{
api-version: string ,
deploymentId: string ,
body:
{
input: string ,
voice: enum ,
response_format: enum ,
speed: number ,
model: string ,
}
,
}

⚐ Response (200)

{
$schema: file ,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
GetAudioTranscriptionAsPlainText (new)
Description :  Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the written language corresponding to the language it was spoken in.
Reference :  Link ¶

⚼ Request

POST:  /deployments/{deploymentId}/audio/transcriptions
{
api-version: string ,
deploymentId: string ,
file: file ,
filename: string ,
response_format: string ,
language: string ,
prompt: string ,
temperature: number ,
timestamp_granularities: array ,
model: string ,
}

⚐ Response (200)

{
$schema: string ,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
GetAudioTranslationAsPlainText (new)
Description :  Gets English language transcribed text and associated metadata from provided spoken audio data.
Reference :  Link ¶

⚼ Request

POST:  /deployments/{deploymentId}/audio/translations
{
api-version: string ,
deploymentId: string ,
file: file ,
filename: string ,
response_format: string ,
prompt: string ,
temperature: number ,
model: string ,
}

⚐ Response (200)

{
$schema: string ,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
GetChatCompletions (new)
Description :  Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
Reference :  Link ¶

⚼ Request

POST:  /deployments/{deploymentId}/chat/completions
{
api-version: string ,
deploymentId: string ,
body:
{
messages:
[
{
role: enum ,
}
,
]
,
functions:
[
{
name: string ,
description: string ,
parameters: string ,
}
,
]
,
function_call: string ,
max_tokens: integer ,
max_completion_tokens: integer ,
temperature: number ,
top_p: number ,
logit_bias: object ,
user: string ,
n: integer ,
stop:
[
string ,
]
,
presence_penalty: number ,
frequency_penalty: number ,
stream: boolean ,
stream_options: object ,
model: string ,
data_sources:
[
{
type: enum ,
}
,
]
,
enhancements:
{
grounding:
{
enabled: boolean ,
}
,
ocr:
{
enabled: boolean ,
}
,
}
,
seed: integer ,
logprobs: boolean ,
top_logprobs: integer ,
response_format:
{
type: string ,
}
,
tools:
[
{
type: string ,
}
,
]
,
tool_choice: string ,
parallel_tool_calls: boolean ,
store: boolean ,
metadata: object ,
reasoning_effort: enum ,
user_security_context:
{
application_name: string ,
end_user_id: string ,
end_user_tenant_id: string ,
source_ip: string ,
}
,
modalities:
[
string ,
]
,
prediction:
{
type: enum ,
content: string ,
}
,
audio:
{
voice: enum ,
format: enum ,
}
,
}
,
}

⚐ Response (200)

{
id: string ,
created: integer ,
choices:
[
{
message:
{
role: enum ,
refusal: string ,
content: string ,
tool_calls:
[
{
type: string ,
id: string ,
}
,
]
,
function_call:
{
name: string ,
arguments: string ,
}
,
audio:
{
id: string ,
expires_at: integer ,
data: string ,
transcript: string ,
}
,
context:
{
citations:
[
{
content: string ,
title: string ,
url: string ,
filepath: string ,
chunk_id: string ,
rerank_score: number ,
}
,
]
,
intent: string ,
all_retrieved_documents:
[
{
content: string ,
title: string ,
url: string ,
filepath: string ,
chunk_id: string ,
rerank_score: number ,
search_queries:
[
string ,
]
,
data_source_index: integer ,
original_search_score: number ,
filter_reason: enum ,
}
,
]
,
}
,
}
,
logprobs: object ,
index: integer ,
finish_reason: enum ,
delta:
{
role: enum ,
refusal: string ,
content: string ,
tool_calls:
[
{
type: string ,
id: string ,
}
,
]
,
function_call:
{
name: string ,
arguments: string ,
}
,
audio:
{
id: string ,
expires_at: integer ,
data: string ,
transcript: string ,
}
,
context:
{
citations:
[
{
content: string ,
title: string ,
url: string ,
filepath: string ,
chunk_id: string ,
rerank_score: number ,
}
,
]
,
intent: string ,
all_retrieved_documents:
[
{
content: string ,
title: string ,
url: string ,
filepath: string ,
chunk_id: string ,
rerank_score: number ,
search_queries:
[
string ,
]
,
data_source_index: integer ,
original_search_score: number ,
filter_reason: enum ,
}
,
]
,
}
,
}
,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
protected_material_text:
{
filtered: boolean ,
detected: boolean ,
}
,
protected_material_code:
{
filtered: boolean ,
detected: boolean ,
URL: string ,
license: string ,
}
,
ungrounded_material:
{
filtered: boolean ,
detected: boolean ,
details:
[
{
completion_start_offset: integer ,
completion_end_offset: integer ,
}
,
]
,
}
,
}
,
enhancements:
{
grounding:
{
lines:
[
{
text: string ,
spans:
[
{
text: string ,
offset: integer ,
length: integer ,
polygon:
[
{
x: number ,
y: number ,
}
,
]
,
}
,
]
,
}
,
]
,
}
,
}
,
}
,
]
,
model: string ,
prompt_filter_results:
[
{
prompt_index: integer ,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
jailbreak:
{
filtered: boolean ,
detected: boolean ,
}
,
indirect_attack:
{
filtered: boolean ,
detected: boolean ,
}
,
}
,
}
,
]
,
system_fingerprint: string ,
usage:
{
completion_tokens: integer ,
prompt_tokens: integer ,
total_tokens: integer ,
prompt_tokens_details:
{
audio_tokens: integer ,
cached_tokens: integer ,
}
,
completion_tokens_details:
{
accepted_prediction_tokens: integer ,
audio_tokens: integer ,
reasoning_tokens: integer ,
rejected_prediction_tokens: integer ,
}
,
}
,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
GetCompletions (new)
Description :  Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
Reference :  Link ¶

⚼ Request

POST:  /deployments/{deploymentId}/completions
{
api-version: string ,
deploymentId: string ,
body:
{
prompt:
[
string ,
]
,
max_tokens: integer ,
temperature: number ,
top_p: number ,
logit_bias: object ,
user: string ,
n: integer ,
logprobs: integer ,
suffix: string ,
echo: boolean ,
stop:
[
string ,
]
,
presence_penalty: number ,
frequency_penalty: number ,
best_of: integer ,
stream: boolean ,
stream_options: object ,
model: string ,
seed: integer ,
}
,
}

⚐ Response (200)

{
id: string ,
created: integer ,
prompt_filter_results:
[
{
prompt_index: integer ,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
jailbreak:
{
filtered: boolean ,
detected: boolean ,
}
,
indirect_attack:
{
filtered: boolean ,
detected: boolean ,
}
,
}
,
}
,
]
,
choices:
[
{
text: string ,
index: integer ,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
protected_material_text:
{
filtered: boolean ,
detected: boolean ,
}
,
protected_material_code:
{
filtered: boolean ,
detected: boolean ,
URL: string ,
license: string ,
}
,
ungrounded_material:
{
filtered: boolean ,
detected: boolean ,
details:
[
{
completion_start_offset: integer ,
completion_end_offset: integer ,
}
,
]
,
}
,
}
,
logprobs: object ,
finish_reason: enum ,
}
,
]
,
usage:
{
completion_tokens: integer ,
prompt_tokens: integer ,
total_tokens: integer ,
prompt_tokens_details:
{
audio_tokens: integer ,
cached_tokens: integer ,
}
,
completion_tokens_details:
{
accepted_prediction_tokens: integer ,
audio_tokens: integer ,
reasoning_tokens: integer ,
rejected_prediction_tokens: integer ,
}
,
}
,
system_fingerprint: string ,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
GetEmbeddings (new)
Description :  Return the embeddings for a given prompt.
Reference :  Link ¶

⚼ Request

POST:  /deployments/{deploymentId}/embeddings
{
api-version: string ,
deploymentId: string ,
body:
{
user: string ,
model: string ,
input:
[
string ,
]
,
encoding_format: enum ,
dimensions: integer ,
input_type: string ,
}
,
}

⚐ Response (200)

{
data:
[
{
embedding:
[
number ,
]
,
index: integer ,
object: enum ,
}
,
]
,
usage:
{
prompt_tokens: integer ,
total_tokens: integer ,
}
,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
GetImageGenerations (new)
Description :  Creates an image given a prompt.
Reference :  Link ¶

⚼ Request

POST:  /deployments/{deploymentId}/images/generations
{
api-version: string ,
deploymentId: string ,
body:
{
model: string ,
prompt: string ,
n: integer ,
size: enum ,
response_format: enum ,
quality: enum ,
style: enum ,
user: string ,
}
,
}

⚐ Response (200)

{
created: integer ,
data:
[
{
url: string ,
b64_json: string ,
content_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
}
,
revised_prompt: string ,
prompt_filter_results:
{
sexual:
{
filtered: boolean ,
severity: enum ,
}
,
violence:
{
filtered: boolean ,
severity: enum ,
}
,
hate:
{
filtered: boolean ,
severity: enum ,
}
,
self_harm:
{
filtered: boolean ,
severity: enum ,
}
,
profanity:
{
filtered: boolean ,
detected: boolean ,
}
,
jailbreak:
{
filtered: boolean ,
detected: boolean ,
}
,
custom_blocklists:
{
filtered: boolean ,
details:
[
{
filtered: boolean ,
id: string ,
}
,
]
,
}
,
}
,
}
,
]
,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: string ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: string ,
innererror: string ,
}
,
}
,
}
,
}
ListFiles (new)
Description :  Gets a list of previously uploaded files.
Reference :  Link ¶

⚼ Request

GET:  /files
{
purpose: string ,
}

⚐ Response (200)

{
object: enum ,
data:
[
{
object: enum ,
id: string ,
bytes: integer ,
filename: string ,
created_at: integer ,
purpose: enum ,
status: enum ,
status_details: string ,
}
,
]
,
}
UploadFile (new)
Description :  Uploads a file for use by other operations.
Reference :  Link ¶

⚼ Request

POST:  /files
{
file: file ,
purpose: string ,
filename: string ,
}

⚐ Response (200)

{
object: enum ,
id: string ,
bytes: integer ,
filename: string ,
created_at: integer ,
purpose: enum ,
status: enum ,
status_details: string ,
}
GetFile (new)
Description :  Returns information about a specific file. Does not retrieve file content.
Reference :  Link ¶

⚼ Request

GET:  /files/{fileId}
{
fileId: string ,
}

⚐ Response (200)

{
object: enum ,
id: string ,
bytes: integer ,
filename: string ,
created_at: integer ,
purpose: enum ,
status: enum ,
status_details: string ,
}
DeleteFile (new)
Description :  Delete a previously uploaded file.
Reference :  Link ¶

⚼ Request

DELETE:  /files/{fileId}
{
fileId: string ,
}

⚐ Response (200)

{
id: string ,
deleted: boolean ,
object: enum ,
}
GetFileContent (new)
Description :  Returns information about a specific file. Does not retrieve file content.
Reference :  Link ¶

⚼ Request

GET:  /files/{fileId}/content
{
fileId: string ,
}

⚐ Response (200)

{
$schema: string ,
}
CreateUpload (new)
Description :  Creates an intermediate Upload object that you can add Parts to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it. Once you complete the Upload, we will create a File object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object. For certain purposes, the correct mime_type must be specified. Please refer to documentation for the supported MIME types for your use case. For guidance on the proper filename extensions for each purpose, please follow the documentation on creating a File.
Reference :  Link ¶

⚼ Request

POST:  /uploads
{
requestBody:
{
filename: string ,
purpose: enum ,
bytes: integer ,
mime_type: string ,
}
,
}

⚐ Response (200)

{
id: string ,
created_at: integer ,
filename: string ,
bytes: integer ,
purpose: enum ,
status: enum ,
expires_at: integer ,
object: enum ,
file: object ,
}
CancelUpload (new)
Description :  Cancels the Upload. No Parts may be added after an Upload is cancelled.
Reference :  Link ¶

⚼ Request

POST:  /uploads/{upload_id}/cancel
{
upload_id: string ,
}

⚐ Response (200)

{
id: string ,
created_at: integer ,
filename: string ,
bytes: integer ,
purpose: enum ,
status: enum ,
expires_at: integer ,
object: enum ,
file: object ,
}
CompleteUpload (new)
Description :  Completes the Upload. Within the returned Upload object, there is a nested File object that is ready to use in the rest of the platform. You can specify the order of the Parts by passing in an ordered list of the Part IDs. The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
Reference :  Link ¶

⚼ Request

POST:  /uploads/{upload_id}/complete
{
upload_id: string ,
requestBody:
{
part_ids:
[
string ,
]
,
md5: string ,
}
,
}

⚐ Response (200)

{
id: string ,
created_at: integer ,
filename: string ,
bytes: integer ,
purpose: enum ,
status: enum ,
expires_at: integer ,
object: enum ,
file: object ,
}
AddUploadPart (new)
Description :  Adds a Part to an Upload object. A Part represents a chunk of bytes from the file you are trying to upload. Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB. It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you complete the Upload.
Reference :  Link ¶

⚼ Request

POST:  /uploads/{upload_id}/parts
{
upload_id: string ,
data: file ,
}

⚐ Response (200)

{
id: string ,
created_at: integer ,
upload_id: string ,
object: enum ,
azure_block_id: string ,
}